using UnityEngine;
#if ENABLE_INPUT_SYSTEM
using UnityEngine.InputSystem;
#endif
namespace LS.GameKit
{
    /// <summary>
    /// QuickInput，快速输入检测，在update里调用
    /// </summary>
    public class QI
    {
#if ENABLE_INPUT_SYSTEM

        public static Vector2 MousePosition()
        {
            return Mouse.current.position.ReadValue();
        }
        
        /// <summary>
        /// 鼠标左键按下
        /// </summary>
        /// <returns>在当前帧的状态</returns>
        public static bool MouseLeftDown()
        {
            return Mouse.current.leftButton.wasPressedThisFrame;
        }

        /// <summary>
        /// 鼠标左键松开
        /// </summary>
        /// <returns>在当前帧的状态</returns>
        public static bool MouseLeftUp()
        {
            return Mouse.current.leftButton.wasReleasedThisFrame;
        }
        
        /// <summary>
        /// 鼠标左键更新
        /// </summary>
        /// <returns>在当前帧的状态</returns>
        public static bool MouseLeft()
        {
            return Mouse.current.leftButton.isPressed;
        }
        
        /// <summary>
        /// 鼠标右键按下
        /// </summary>
        /// <returns>在当前帧的状态</returns>
        public static bool MouseRightDown()
        {
            return Mouse.current.rightButton.wasPressedThisFrame;
        }

        /// <summary>
        /// 鼠标右键松开
        /// </summary>
        /// <returns>在当前帧的状态</returns>
        public static bool MouseRightUp()
        {
            return Mouse.current.rightButton.wasReleasedThisFrame;
        }

        /// <summary>
        /// 鼠标右键更新
        /// </summary>
        /// <returns>在当前帧的状态</returns>
        public static bool MouseRight()
        {
            return Mouse.current.rightButton.isPressed;
        }
        
        public static bool WKey()
        {
            return Keyboard.current.wKey.isPressed;
        }

        public static bool WKeyDown()
        {
            return  Keyboard.current.wKey.wasPressedThisFrame;
        }

        public static bool WKeyUp()
        {
            return Keyboard.current.wKey.wasReleasedThisFrame;
        }
        
        public static bool AKey()
        {
            return Keyboard.current.aKey.isPressed;
        }

        public static bool AKeyDown()
        {
            return Keyboard.current.aKey.wasPressedThisFrame;
        }

        public static bool AKeyUp()
        {
            return Keyboard.current.aKey.wasReleasedThisFrame;
        }
        
        public static bool SKey()
        {
            return Keyboard.current.sKey.isPressed;
        }

        public static bool SKeyDown()
        {
            return Keyboard.current.sKey.wasPressedThisFrame;
        }

        public static bool SKeyUp()
        {
            return Keyboard.current.sKey.wasReleasedThisFrame;
        }
        
        public static bool DKey()
        {
            return Keyboard.current.dKey.isPressed;
        }

        public static bool DKeyDown()
        {
            return Keyboard.current.dKey.wasPressedThisFrame;
        }

        public static bool DKeyUp()
        {
            return Keyboard.current.dKey.wasReleasedThisFrame;
        }

        public static bool UpKey()
        {
            return Keyboard.current.upArrowKey.isPressed;
        }

        public static bool UpKeyDown()
        {
            return Keyboard.current.upArrowKey.wasPressedThisFrame;
        }

        public static bool UpKeyUp()
        {
            return Keyboard.current.upArrowKey.wasReleasedThisFrame;
        }

        public static bool DownKey()
        {
            return Keyboard.current.downArrowKey.isPressed;
        }

        public static bool DownKeyDown()
        {
            return Keyboard.current.downArrowKey.wasReleasedThisFrame;
        }

        public static bool DownKeyUp()
        {
            return Keyboard.current.downArrowKey.wasReleasedThisFrame;
        }

        public static bool LeftKey()
        {
            return Keyboard.current.leftArrowKey.isPressed;
        }

        public static bool LeftKeyDown()
        {
            return Keyboard.current.leftArrowKey.wasPressedThisFrame;
        }

        public static bool LeftKeyUp()
        {
            return Keyboard.current.leftArrowKey.wasReleasedThisFrame;
        }

        public static bool RightKey()
        {
            return Keyboard.current.rightArrowKey.isPressed;
        }

        public static bool RightKeyDown()
        {
            return Keyboard.current.rightArrowKey.wasPressedThisFrame;
        }

        public static bool RightKeyUp()
        {
            return Keyboard.current.rightArrowKey.wasReleasedThisFrame;
        }

        public static bool SpaceKey()
        {
            return Keyboard.current.spaceKey.isPressed;
        }

        public static bool SpaceKeyDown()
        {
            return Keyboard.current.spaceKey.wasPressedThisFrame;
        }

        public static bool SpaceKeyUp()
        {
            return Keyboard.current.spaceKey.wasReleasedThisFrame;
        }
        
#else
        public static Vector2 MousePosition()
        {
            return Input.mousePosition;
        }
        
        /// <summary>
        /// 鼠标左键按下
        /// </summary>
        /// <returns>在当前帧的状态</returns>
        public static bool MouseLeftDown()
        {
            return Input.GetMouseButtonDown(0);
        }

        /// <summary>
        /// 鼠标左键松开
        /// </summary>
        /// <returns>在当前帧的状态</returns>
        public static bool MouseLeftUp()
        {
            return Input.GetMouseButtonUp(0);
        }
        
        /// <summary>
        /// 鼠标左键更新
        /// </summary>
        /// <returns>在当前帧的状态</returns>
        public static bool MouseLeft()
        {
            return Input.GetMouseButton(0);
        }
        
        /// <summary>
        /// 鼠标右键按下
        /// </summary>
        /// <returns>在当前帧的状态</returns>
        public static bool MouseRightDown()
        {
            return Input.GetMouseButtonDown(1);
        }

        /// <summary>
        /// 鼠标右键松开
        /// </summary>
        /// <returns>在当前帧的状态</returns>
        public static bool MouseRightUp()
        {
            return Input.GetMouseButtonUp(1);
        }

        /// <summary>
        /// 鼠标右键更新
        /// </summary>
        /// <returns>在当前帧的状态</returns>
        public static bool MouseRight()
        {
            return Input.GetMouseButton(1);
        }

        public static bool W()
        {
            return Input.GetKey(KeyCode.W);
        }

        public static bool WDown()
        {
            return Input.GetKeyDown(KeyCode.W);
        }

        public static bool WUp()
        {
            return Input.GetKeyUp(KeyCode.W);
        }
        
        public static bool A()
        {
            return Input.GetKey(KeyCode.A);
        }

        public static bool ADown()
        {
            return Input.GetKeyDown(KeyCode.A);
        }

        public static bool AUp()
        {
            return Input.GetKeyUp(KeyCode.A);
        }
        
        public static bool S()
        {
            return Input.GetKey(KeyCode.S);
        }

        public static bool SDown()
        {
            return Input.GetKeyDown(KeyCode.S);
        }

        public static bool SUp()
        {
            return Input.GetKeyUp(KeyCode.S);
        }
        
        public static bool D()
        {
            return Input.GetKey(KeyCode.D);
        }

        public static bool DDown()
        {
            return Input.GetKeyDown(KeyCode.D);
        }

        public static bool DUp()
        {
            return Input.GetKeyUp(KeyCode.D);
        }

        public static bool UpKey()
        {
            return Input.GetKey(KeyCode.UpArrow);
        }

        public static bool UpKeyDown()
        {
            return Input.GetKeyDown(KeyCode.UpArrow);
        }

        public static bool UpKeyUp()
        {
            return Input.GetKeyUp(KeyCode.UpArrow);
        }

        public static bool DownKey()
        {
            return Input.GetKey(KeyCode.DownArrow);
        }

        public static bool DownKeyDown()
        {
            return Input.GetKeyDown(KeyCode.DownArrow);
        }

        public static bool DownKeyUp()
        {
            return Input.GetKeyUp(KeyCode.DownArrow);
        }

        public static bool LeftKey()
        {
            return Input.GetKey(KeyCode.LeftArrow);
        }

        public static bool LeftKeyDown()
        {
            return Input.GetKeyDown(KeyCode.LeftArrow);
        }

        public static bool LeftKeyUp()
        {
            return Input.GetKeyUp(KeyCode.LeftArrow);
        }

        public static bool RightKey()
        {
            return Input.GetKey(KeyCode.RightArrow);
        }

        public static bool RightKeyDown()
        {
            return Input.GetKeyDown(KeyCode.RightArrow);
        }

        public static bool RightKeyUp()
        {
            return Input.GetKeyUp(KeyCode.RightArrow);
        }
        
        public static bool SpaceKey()
        {
            return Input.GetKey(KeyCode.Space);
        }

        public static bool SpaceKeyDown()
        {
            return Input.GetKeyDown(KeyCode.Space);
        }

        public static bool SpaceKeyUp()
        {
            return Input.GetKeyUp(KeyCode.Space);
        }
#endif
    }
}
